package com.appview;

import com.util.Config;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * Created by Qi_Huang on 2015/11/3.
 */
public class TextTip extends JFrame implements ActionListener {
    private JLabel[] jLabels;
    private JButton jButton;


    public TextTip() {
        if (Config.getType() == 0) {
            jLabels = new JLabel[Config.TEAC_LIST.length];
            jLabels[0] = new JLabel("1.填入工号（如201430350310）");
            jLabels[1] = new JLabel("2.填入姓名（如张三）");
            jLabels[2] = new JLabel("3.填入年龄（如21）");
            jLabels[3] = new JLabel("4.填入性别（男或女）");
            jLabels[4] = new JLabel("5.填入生日（如19950506）");
            jLabels[5] = new JLabel("6.填入居住地（如广东广州）");
            jLabels[6] = new JLabel("7.填入政治面貌（如团员）");
            jLabels[7] = new JLabel("8.填入学院（如数学与信息学院）");
            jLabels[8] = new JLabel("9.填入专业（如网络工程）");
            jLabels[9] = new JLabel("10.填入工龄（如5）");
            jLabels[10] = new JLabel("11.填入职位（如普通教师、院长）");
        } else {
            jLabels = new JLabel[Config.STU_LIST.length];
            jLabels[0] = new JLabel("1.填入学号（如201430350310）");
            jLabels[1] = new JLabel("2.填入姓名（如张三）");
            jLabels[2] = new JLabel("3.填入年龄（如21）");
            jLabels[3] = new JLabel("4.填入性别（男或女）");
            jLabels[4] = new JLabel("5.填入生日（如19950506）");
            jLabels[5] = new JLabel("6.填入居住地（如广东广州）");
            jLabels[6] = new JLabel("7.填入政治面貌（如团员）");
            jLabels[7] = new JLabel("8.填入学院（如数学与信息学院）");
            jLabels[8] = new JLabel("9.填入专业班级（如网络工程3班）");
        }
        jButton = new JButton("关闭");
        jButton.addActionListener(this);
        for (JLabel jLabel : jLabels) {
            add(jLabel);
        }
        add(jButton);
        setVisible(true);
        setSize(300, 400);
        setLocation(700, 200);
        setResizable(false);
        setLayout(new GridLayout(jLabels.length + 1, 1));
        setTitle("文本提示");
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        this.dispose();
    }

}
